﻿using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TemplateEngineWithChart.Docx.TemplateCustomContent;

namespace TemplateEngineWithChart.Docx
{
    [ContentItemName("Chart")]
    public class ChartContent : HiddenContent<ChartContent>, IEquatable<ChartContent>
    {
        #region properties

        public ChartData ChartData { get; set; }

        #endregion properties

        #region ctors

        public ChartContent()
        {

        }

        public ChartContent(string name)
        {
            Name = name;
        }

        public ChartContent(string name, ChartData chartData)
            : this(name)
        {
            this.ChartData = chartData;
        }

        #endregion

        #region Equals
        public bool Equals(ChartContent other)
        {
            if (other == null) return false;

            return Name.Equals(other.Name) &&
                   this.ChartData.Equals(other.ChartData);
        }

        public override bool Equals(IContentItem other)
        {
            if (!(other is ChartContent)) return false;

            return Equals((ChartContent)other);
        }
        #endregion
    }
}
